package com.jic.point.common;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author bourne
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Result<T> implements Serializable {



    private String error;
    private T result;
    private String success;
    private String message;


    public static Result error(String message, String error) {
        return Result.builder()
                .error(error)
                .message(message)
                .build();
    }

    public static <T> Result<T> success(String success, T data) {
        return Result.<T>builder()
                .success(success)
                .result(data)
                .build();
    }

//    public static boolean checkIsSuccess(RestResult restResult) {
//        if (restResult != null && SUCCESS_CODE.equals(restResult.getCode())) {
//            return true;
//        }
//        return false;
//    }
}
